package cays.student.dao;

import cays.student.vo.Course;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * 课程信息接口
 */
public interface CourseDao {
    @Select("select * from course")
    List<Course> getAllCourse();
    @Select("select * from course where cno=#{cno}")
    Course getCourseByCno(@Param("cno") String cno);
    @Update("<script>update course<set>" +
            "<if test='cname != null'>cname=#{cname},</if>" +
            "<if test='cpre != null'>cpre=#{cpre}</if></set>" +
            "<where>cno=#{cno}</where>" +
            "</script>")
    int updateCourseByCno(Course course);
    @Insert("insert into course values (#{cno},#{cname},#{cpre})")
    int insertCourse(Course course);
    @Delete("delete course where cno=#{cno}")
    int deleteCourseByCno(@Param("cno") String cno);
}
